<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>果智通 - 果蔬汁加工智能助手</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    
    <!-- Tailwind 配置 -->
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#2E7D32',      // 主色调：绿色，代表新鲜、健康
                        secondary: '#FF8F00',    // 辅助色：橙色，代表水果、活力
                        accent: '#1976D2',       // 强调色：蓝色
                        neutral: '#F5F5F5',      // 中性色：浅灰
                        dark: '#263238',         // 深色：深灰
                    },
                    fontFamily: {
                        sans: ['Inter', 'system-ui', 'sans-serif'],
                    },
                }
            }
        }
    </script>
    
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .card-shadow {
                box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
            }
            .transition-custom {
                transition: all 0.3s ease;
            }
            .tab-active {
                border-bottom: 3px solid theme('colors.primary');
                color: theme('colors.primary');
                font-weight: 600;
            }
        }
    </style>
</head>
<body class="bg-gray-50 font-sans text-dark">
    <!-- 顶部导航栏 -->
    <header class="bg-white shadow-md fixed w-full top-0 z-50 transition-custom">
        <div class="container mx-auto px-4 py-3 flex justify-between items-center">
            <div class="flex items-center space-x-2">
                <i class="fa fa-apple text-2xl text-primary"></i>
                <h1 class="text-xl md:text-2xl font-bold text-primary">果智通</h1>
                <span class="hidden md:inline-block text-sm bg-secondary/10 text-secondary px-2 py-0.5 rounded-full">AI智能助手</span>
            </div>
            <div class="flex items-center space-x-4">
                <a href="#" class="hidden md:block text-sm hover:text-primary transition-custom">
                    <i class="fa fa-question-circle mr-1"></i>帮助中心
                </a>
                <a href="#" class="hidden md:block text-sm hover:text-primary transition-custom">
                    <i class="fa fa-phone mr-1"></i>联系我们
                </a>
               
            </div>
        </div>
    </header>

    <!-- 主内容区 -->
    <main class="container mx-auto px-4 pt-24 pb-16">
        <!-- 页面标题和介绍 -->
        <div class="text-center mb-10">
            <h2 class="text-[clamp(1.5rem,3vw,2.5rem)] font-bold text-dark mb-3">果蔬汁加工智能解决方案</h2>
            <p class="text-gray-600 max-w-2xl mx-auto">
                基于AI技术与多年行业经验，为您提供从原料分析到市场策略的全方位支持，
                优化生产流程，提升产品质量，降低运营成本
            </p>
        </div>
        
        <!-- 功能卡片概览 -->
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12">
            <div class="bg-white rounded-xl p-6 card-shadow hover:shadow-lg transition-custom transform hover:-translate-y-1">
                <div class="w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-4">
                    <i class="fa fa-lemon-o text-xl text-primary"></i>
                </div>
                <h3 class="text-lg font-semibold mb-2">原料分析</h3>
                <p class="text-gray-600 text-sm">智能分析果蔬原料特性，提供加工适用性评估和处理建议</p>
            </div>
            
            <div class="bg-white rounded-xl p-6 card-shadow hover:shadow-lg transition-custom transform hover:-translate-y-1">
                <div class="w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-4">
                    <i class="fa fa-cogs text-xl text-primary"></i>
                </div>
                <h3 class="text-lg font-semibold mb-2">设备推荐</h3>
                <p class="text-gray-600 text-sm">根据生产需求，精准推荐最适合的设备及生产线配置</p>
            </div>
            
            <div class="bg-white rounded-xl p-6 card-shadow hover:shadow-lg transition-custom transform hover:-translate-y-1">
                <div class="w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-4">
                    <i class="fa fa-line-chart text-xl text-primary"></i>
                </div>
                <h3 class="text-lg font-semibold mb-2">工艺优化</h3>
                <p class="text-gray-600 text-sm">分析生产瓶颈，提供针对性工艺改进方案，提升效率与品质</p>
            </div>
            
            <div class="bg-white rounded-xl p-6 card-shadow hover:shadow-lg transition-custom transform hover:-translate-y-1">
                <div class="w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-4">
                    <i class="fa fa-wrench text-xl text-primary"></i>
                </div>
                <h3 class="text-lg font-semibold mb-2">故障诊断</h3>
                <p class="text-gray-600 text-sm">智能诊断设备故障，提供专业维修建议，减少停机时间</p>
            </div>
            
            <div class="bg-white rounded-xl p-6 card-shadow hover:shadow-lg transition-custom transform hover:-translate-y-1">
                <div class="w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-4">
                    <i class="fa fa-flask text-xl text-primary"></i>
                </div>
                <h3 class="text-lg font-semibold mb-2">配方推荐</h3>
                <p class="text-gray-600 text-sm">基于原料特性与市场需求，提供创新配方与产品开发建议</p>
            </div>
            
            <div class="bg-white rounded-xl p-6 card-shadow hover:shadow-lg transition-custom transform hover:-translate-y-1">
                <div class="w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-4">
                    <i class="fa fa-bar-chart text-xl text-primary"></i>
                </div>
                <h3 class="text-lg font-semibold mb-2">市场分析</h3>
                <p class="text-gray-600 text-sm">分析市场趋势与消费者需求，提供产品定位与营销策略</p>
            </div>
        </div>
        
        <!-- 功能标签页 -->
        <div class="bg-white rounded-xl shadow-md overflow-hidden">
            <!-- 标签页导航 -->
            <div class="border-b border-gray-200 overflow-x-auto flex">
                <button class="tab-btn tab-active px-6 py-4 whitespace-nowrap focus:outline-none" data-tab="raw-material">
                    <i class="fa fa-lemon-o mr-2"></i>原料分析
                </button>
                <button class="tab-btn px-6 py-4 whitespace-nowrap focus:outline-none" data-tab="equipment">
                    <i class="fa fa-cogs mr-2"></i>设备推荐
                </button>
                <button class="tab-btn px-6 py-4 whitespace-nowrap focus:outline-none" data-tab="process">
                    <i class="fa fa-line-chart mr-2"></i>工艺优化
                </button>
                <button class="tab-btn px-6 py-4 whitespace-nowrap focus:outline-none" data-tab="fault">
                    <i class="fa fa-wrench mr-2"></i>故障诊断
                </button>
                <button class="tab-btn px-6 py-4 whitespace-nowrap focus:outline-none" data-tab="formula">
                    <i class="fa fa-flask mr-2"></i>配方推荐
                </button>
                <button class="tab-btn px-6 py-4 whitespace-nowrap focus:outline-none" data-tab="market">
                    <i class="fa fa-bar-chart mr-2"></i>市场分析
                </button>
            </div>
            
            <!-- 标签页内容 -->
            <div class="p-6">
                <!-- 1. 原料分析 -->
                <div class="tab-content active" id="raw-material-content">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fa fa-lemon-o text-primary mr-2"></i>原料特性分析
                    </h3>
                    <p class="text-gray-600 mb-6">输入原料信息并上传图片，获取详细的加工特性分析，包括成分、适用工艺和搭配建议</p>
                    
                    <form id="rawMaterialForm" class="space-y-6">
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                            <div>
                                <label for="rawMaterialName" class="block text-sm font-medium text-gray-700 mb-1">原料名称 *</label>
                                <input type="text" id="rawMaterialName" name="rawMaterialName" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    placeholder="例如：苹果、胡萝卜、蓝莓" required>
                            </div>
                            
                            <div>
                                <label for="rawMaterialImage" class="block text-sm font-medium text-gray-700 mb-1">原料图片 (可选)</label>
                                <div class="flex items-center justify-center w-full">
                                    <label for="rawMaterialImage" class="flex flex-col items-center justify-center w-full h-32 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition-custom">
                                        <div class="flex flex-col items-center justify-center pt-5 pb-6">
                                            <i class="fa fa-cloud-upload text-2xl text-gray-400 mb-2"></i>
                                            <p class="mb-1 text-sm text-gray-500"><span class="font-semibold">点击上传</span> 或拖放文件</p>
                                            <p class="text-xs text-gray-500">支持 JPG, PNG 格式</p>
                                        </div>
                                        <input id="rawMaterialImage" name="rawMaterialImage" type="file" class="hidden" accept="image/*" />
                                    </label>
                                </div>
                                <div id="imagePreview" class="mt-2 hidden">
                                    <img id="previewImg" src="" alt="原料预览图" class="max-h-40 rounded-lg border">
                                </div>
                            </div>
                        </div>
                        
                        <div class="flex justify-end">
                            <button type="submit" class="bg-primary hover:bg-primary/90 text-white px-6 py-2.5 rounded-lg font-medium transition-custom flex items-center">
                                <i class="fa fa-search mr-2"></i>分析原料特性
                            </button>
                        </div>
                    </form>
                    
                    <!-- 结果区域 -->
                    <div id="rawMaterialResult" class="mt-8 hidden">
                        <div class="border-t border-gray-200 pt-6">
                            <h4 class="font-semibold text-lg mb-3">分析结果</h4>
                            <div class="bg-gray-50 p-5 rounded-lg border border-gray-200">
                                <div class="loading-indicator flex items-center justify-center py-8 hidden">
                                    <div class="animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-primary"></div>
                                    <span class="ml-3 text-gray-600">正在分析原料特性，请稍候...</span>
                                </div>
                                <div id="rawMaterialResultContent" class="prose max-w-none"></div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 2. 设备推荐 -->
                <div class="tab-content hidden" id="equipment-content">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fa fa-cogs text-primary mr-2"></i>生产线设备推荐
                    </h3>
                    <p class="text-gray-600 mb-6">根据您的生产需求，推荐最合适的设备配置方案，包括完整的生产线布局和投资估算</p>
                    
                    <form id="equipmentForm" class="space-y-6">
                        <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                            <div>
                                <label for="capacity" class="block text-sm font-medium text-gray-700 mb-1">预计产能 (吨/小时) *</label>
                                <input type="number" id="capacity" name="capacity" min="0.1" step="0.1" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    placeholder="例如：2.0" required>
                            </div>
                            
                            <div>
                                <label for="productType" class="block text-sm font-medium text-gray-700 mb-1">产品类型 *</label>
                                <select id="productType" name="productType" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    required>
                                    <option value="">请选择产品类型</option>
                                    <option value="澄清汁">澄清汁</option>
                                    <option value="浑浊汁">浑浊汁</option>
                                    <option value="浓缩汁">浓缩汁</option>
                                    <option value="带果肉果汁">带果肉果汁</option>
                                    <option value="混合果蔬汁">混合果蔬汁</option>
                                </select>
                            </div>
                            
                            <div>
                                <label for="productionScale" class="block text-sm font-medium text-gray-700 mb-1">生产规模 *</label>
                                <select id="productionScale" name="productionScale" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    required>
                                    <option value="">请选择生产规模</option>
                                    <option value="小型试产线">小型试产线</option>
                                    <option value="中型生产线">中型生产线</option>
                                    <option value="大型工业化生产线">大型工业化生产线</option>
                                </select>
                            </div>
                        </div>
                        
                        <div>
                            <label for="rawMaterials" class="block text-sm font-medium text-gray-700 mb-1">原料种类 *</label>
                            <input type="text" id="rawMaterials" name="rawMaterials" 
                                class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                placeholder="请输入原料，用逗号分隔（例如：苹果, 梨, 胡萝卜）" required>
                        </div>
                        
                        <div class="flex justify-end">
                            <button type="submit" class="bg-primary hover:bg-primary/90 text-white px-6 py-2.5 rounded-lg font-medium transition-custom flex items-center">
                                <i class="fa fa-lightbulb-o mr-2"></i>推荐设备配置
                            </button>
                        </div>
                    </form>
                    
                    <!-- 结果区域 -->
                    <div id="equipmentResult" class="mt-8 hidden">
                        <div class="border-t border-gray-200 pt-6">
                            <h4 class="font-semibold text-lg mb-3">设备配置推荐结果</h4>
                            <div class="bg-gray-50 p-5 rounded-lg border border-gray-200">
                                <div class="loading-indicator flex items-center justify-center py-8 hidden">
                                    <div class="animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-primary"></div>
                                    <span class="ml-3 text-gray-600">正在生成设备推荐方案，请稍候...</span>
                                </div>
                                <div id="equipmentResultContent" class="prose max-w-none"></div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 3. 工艺优化 -->
                <div class="tab-content hidden" id="process-content">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fa fa-line-chart text-primary mr-2"></i>生产工艺优化
                    </h3>
                    <p class="text-gray-600 mb-6">分析当前生产工艺，提供优化建议和问题解决方案，提升生产效率和产品质量</p>
                    
                    <form id="processForm" class="space-y-6">
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                            <div>
                                <label for="processRawMaterials" class="block text-sm font-medium text-gray-700 mb-1">原料种类 *</label>
                                <input type="text" id="processRawMaterials" name="processRawMaterials" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    placeholder="请输入原料，用逗号分隔" required>
                            </div>
                            
                            <div>
                                <label for="processProductType" class="block text-sm font-medium text-gray-700 mb-1">产品类型 *</label>
                                <select id="processProductType" name="processProductType" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    required>
                                    <option value="">请选择产品类型</option>
                                    <option value="澄清汁">澄清汁</option>
                                    <option value="浑浊汁">浑浊汁</option>
                                    <option value="浓缩汁">浓缩汁</option>
                                    <option value="带果肉果汁">带果肉果汁</option>
                                    <option value="混合果蔬汁">混合果蔬汁</option>
                                </select>
                            </div>
                        </div>
                        
                        <div>
                            <label for="currentIssues" class="block text-sm font-medium text-gray-700 mb-1">当前存在的问题 *</label>
                            <textarea id="currentIssues" name="currentIssues" rows="3"
                                class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                placeholder="例如：出汁率低、口感不佳、色泽不理想等" required></textarea>
                        </div>
                        
                        <div>
                            <label for="productionData" class="block text-sm font-medium text-gray-700 mb-1">生产数据 (可选)</label>
                            <textarea id="productionData" name="productionData" rows="2"
                                class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                placeholder="例如：出汁率、糖度、酸度等数据"></textarea>
                        </div>
                        
                        <div class="flex justify-end">
                            <button type="submit" class="bg-primary hover:bg-primary/90 text-white px-6 py-2.5 rounded-lg font-medium transition-custom flex items-center">
                                <i class="fa fa-refresh mr-2"></i>优化生产工艺
                            </button>
                        </div>
                    </form>
                    
                    <!-- 结果区域 -->
                    <div id="processResult" class="mt-8 hidden">
                        <div class="border-t border-gray-200 pt-6">
                            <h4 class="font-semibold text-lg mb-3">工艺优化建议</h4>
                            <div class="bg-gray-50 p-5 rounded-lg border border-gray-200">
                                <div class="loading-indicator flex items-center justify-center py-8 hidden">
                                    <div class="animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-primary"></div>
                                    <span class="ml-3 text-gray-600">正在分析并生成优化方案，请稍候...</span>
                                </div>
                                <div id="processResultContent" class="prose max-w-none"></div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 4. 故障诊断 -->
                <div class="tab-content hidden" id="fault-content">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fa fa-wrench text-primary mr-2"></i>设备故障诊断
                    </h3>
                    <p class="text-gray-600 mb-6">描述设备故障现象，上传图片，获取专业诊断和解决方案，减少停机时间</p>
                    
                    <form id="faultForm" class="space-y-6">
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                            <div>
                                <label for="equipmentType" class="block text-sm font-medium text-gray-700 mb-1">设备类型 *</label>
                                <select id="equipmentType" name="equipmentType" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    required>
                                    <option value="">请选择设备类型</option>
                                    <option value="榨汁设备">榨汁设备</option>
                                    <option value="杀菌设备">杀菌设备</option>
                                    <option value="灌装设备">灌装设备</option>
                                    <option value="预处理设备">预处理设备</option>
                                    <option value="其他设备">其他设备</option>
                                </select>
                            </div>
                            
                            <div>
                                <label for="faultImage" class="block text-sm font-medium text-gray-700 mb-1">故障部位图片 (可选)</label>
                                <div class="flex items-center justify-center w-full">
                                    <label for="faultImage" class="flex flex-col items-center justify-center w-full h-32 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition-custom">
                                        <div class="flex flex-col items-center justify-center pt-5 pb-6">
                                            <i class="fa fa-cloud-upload text-2xl text-gray-400 mb-2"></i>
                                            <p class="mb-1 text-sm text-gray-500"><span class="font-semibold">点击上传</span> 或拖放文件</p>
                                            <p class="text-xs text-gray-500">支持 JPG, PNG 格式</p>
                                        </div>
                                        <input id="faultImage" name="faultImage" type="file" class="hidden" accept="image/*" />
                                    </label>
                                </div>
                                <div id="faultImagePreview" class="mt-2 hidden">
                                    <img id="faultPreviewImg" src="" alt="故障部位预览图" class="max-h-40 rounded-lg border">
                                </div>
                            </div>
                        </div>
                        
                        <div>
                            <label for="faultDescription" class="block text-sm font-medium text-gray-700 mb-1">故障描述 *</label>
                            <textarea id="faultDescription" name="faultDescription" rows="3"
                                class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                placeholder="请详细描述设备故障现象，例如：设备运行时有异常噪音，出汁率下降等" required></textarea>
                        </div>
                        
                        <div class="flex justify-end">
                            <button type="submit" class="bg-primary hover:bg-primary/90 text-white px-6 py-2.5 rounded-lg font-medium transition-custom flex items-center">
                                <i class="fa fa-stethoscope mr-2"></i>诊断故障
                            </button>
                        </div>
                    </form>
                    
                    <!-- 结果区域 -->
                    <div id="faultResult" class="mt-8 hidden">
                        <div class="border-t border-gray-200 pt-6">
                            <h4 class="font-semibold text-lg mb-3">故障诊断结果</h4>
                            <div class="bg-gray-50 p-5 rounded-lg border border-gray-200">
                                <div class="loading-indicator flex items-center justify-center py-8 hidden">
                                    <div class="animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-primary"></div>
                                    <span class="ml-3 text-gray-600">正在诊断故障，请稍候...</span>
                                </div>
                                <div id="faultResultContent" class="prose max-w-none"></div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 5. 配方推荐 -->
                <div class="tab-content hidden" id="formula-content">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fa fa-flask text-primary mr-2"></i>果蔬汁配方推荐
                    </h3>
                    <p class="text-gray-600 mb-6">根据原料和市场需求，推荐最佳配方方案，提升产品竞争力</p>
                    
                    <form id="formulaForm" class="space-y-6">
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                            <div>
                                <label for="formulaRawMaterials" class="block text-sm font-medium text-gray-700 mb-1">可用原料 *</label>
                                <input type="text" id="formulaRawMaterials" name="formulaRawMaterials" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    placeholder="请输入可用原料，用逗号分隔" required>
                            </div>
                            
                            <div>
                                <label for="targetFlavor" class="block text-sm font-medium text-gray-700 mb-1">目标风味 *</label>
                                <select id="targetFlavor" name="targetFlavor" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    required>
                                    <option value="">请选择目标风味</option>
                                    <option value="清甜">清甜</option>
                                    <option value="酸甜">酸甜</option>
                                    <option value="浓郁">浓郁</option>
                                    <option value="清爽">清爽</option>
                                    <option value="醇厚">醇厚</option>
                                </select>
                            </div>
                        </div>
                        
                        <div>
                            <label for="nutritionalGoals" class="block text-sm font-medium text-gray-700 mb-1">营养目标 *</label>
                            <input type="text" id="nutritionalGoals" name="nutritionalGoals" 
                                class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                placeholder="例如：高维生素C、低糖分、高纤维等" required>
                        </div>
                        
                        <div>
                            <label for="marketPosition" class="block text-sm font-medium text-gray-700 mb-1">市场定位 *</label>
                            <select id="marketPosition" name="marketPosition" 
                                class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                required>
                                    <option value="">请选择市场定位</option>
                                    <option value="大众消费">大众消费</option>
                                    <option value="高端健康">高端健康</option>
                                    <option value="儿童专用">儿童专用</option>
                                    <option value="功能性饮料">功能性饮料</option>
                            </select>
                        </div>
                        
                        <div class="flex justify-end">
                            <button type="submit" class="bg-primary hover:bg-primary/90 text-white px-6 py-2.5 rounded-lg font-medium transition-custom flex items-center">
                                <i class="fa fa-magic mr-2"></i>推荐配方
                            </button>
                        </div>
                    </form>
                    
                    <!-- 结果区域 -->
                    <div id="formulaResult" class="mt-8 hidden">
                        <div class="border-t border-gray-200 pt-6">
                            <h4 class="font-semibold text-lg mb-3">配方推荐结果</h4>
                            <div class="bg-gray-50 p-5 rounded-lg border border-gray-200">
                                <div class="loading-indicator flex items-center justify-center py-8 hidden">
                                    <div class="animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-primary"></div>
                                    <span class="ml-3 text-gray-600">正在生成配方推荐，请稍候...</span>
                                </div>
                                <div id="formulaResultContent" class="prose max-w-none"></div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 6. 市场分析 -->
                <div class="tab-content hidden" id="market-content">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fa fa-bar-chart text-primary mr-2"></i>市场趋势分析
                    </h3>
                    <p class="text-gray-600 mb-6">分析市场趋势，为产品定位和营销策略提供建议，把握市场机遇</p>
                    
                    <form id="marketForm" class="space-y-6">
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                            <div>
                                <label for="marketProductType" class="block text-sm font-medium text-gray-700 mb-1">产品类型 *</label>
                                <select id="marketProductType" name="marketProductType" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    required>
                                    <option value="">请选择产品类型</option>
                                    <option value="澄清汁">澄清汁</option>
                                    <option value="浑浊汁">浑浊汁</option>
                                    <option value="浓缩汁">浓缩汁</option>
                                    <option value="带果肉果汁">带果肉果汁</option>
                                    <option value="混合果蔬汁">混合果蔬汁</option>
                                    <option value="功能性果蔬汁">功能性果蔬汁</option>
                                </select>
                            </div>
                            
                            <div>
                                <label for="targetRegion" class="block text-sm font-medium text-gray-700 mb-1">目标市场 *</label>
                                <select id="targetRegion" name="targetRegion" 
                                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                    required>
                                    <option value="">请选择目标市场</option>
                                    <option value="国内市场">国内市场</option>
                                    <option value="欧洲市场">欧洲市场</option>
                                    <option value="北美市场">北美市场</option>
                                    <option value="东南亚市场">东南亚市场</option>
                                    <option value="全球市场">全球市场</option>
                                </select>
                            </div>
                        </div>
                        
                        <div>
                            <label for="marketTrends" class="block text-sm font-medium text-gray-700 mb-1">已知市场趋势 (可选)</label>
                            <textarea id="marketTrends" name="marketTrends" rows="2"
                                class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-custom"
                                placeholder="例如：低糖、有机、功能性等趋势"></textarea>
                        </div>
                        
                        <div class="flex justify-end">
                            <button type="submit" class="bg-primary hover:bg-primary/90 text-white px-6 py-2.5 rounded-lg font-medium transition-custom flex items-center">
                                <i class="fa fa-pie-chart mr-2"></i>分析市场
                            </button>
                        </div>
                    </form>
                    
                    <!-- 结果区域 -->
                    <div id="marketResult" class="mt-8 hidden">
                        <div class="border-t border-gray-200 pt-6">
                            <h4 class="font-semibold text-lg mb-3">市场分析结果</h4>
                            <div class="bg-gray-50 p-5 rounded-lg border border-gray-200">
                                <div class="loading-indicator flex items-center justify-center py-8 hidden">
                                    <div class="animate-spin rounded-full h-10 w-10 border-t-2 border-b-2 border-primary"></div>
                                    <span class="ml-3 text-gray-600">正在进行市场分析，请稍候...</span>
                                </div>
                                <div id="marketResultContent" class="prose max-w-none"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 关于 -->
        <div class="mt-12 bg-white rounded-xl p-6 shadow-md">
            <h3 class="text-xl font-semibold mb-4">关于果蔬汁机械有限公司</h3>
            <p class="text-gray-600 mb-4">
                果蔬汁机械有限公司是专业从事果蔬汁加工设备研发、制造与销售的高新技术企业，
                拥有数十年行业经验，产品覆盖果蔬预处理、榨汁、杀菌、灌装等全系列生产线设备。
            </p>
            <p class="text-gray-600">
                公司致力于为全球果蔬汁加工企业提供高效、节能、智能化的解决方案，
                客户遍布全国各地及海外多个国家和地区。
            </p>
        </div>
    </main>

    <!-- 页脚 -->
    <footer class="bg-dark text-white py-10">
        <div class="container mx-auto px-4">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div>
                    <div class="flex items-center space-x-2 mb-4">
                        <i class="fa fa-apple text-2xl text-secondary"></i>
                        <h3 class="text-xl font-bold">果智通</h3>
                    </div>
                    <p class="text-gray-400 text-sm">
                        果蔬汁加工智能助手，为您的生产提供全方位AI支持
                    </p>
                </div>
                
                <div>
                    <h4 class="font-semibold mb-4">功能导航</h4>
                    <ul class="space-y-2 text-gray-400 text-sm">
                        <li><a href="#" class="hover:text-secondary transition-custom tab-link" data-tab="raw-material">原料分析</a></li>
                        <li><a href="#" class="hover:text-secondary transition-custom tab-link" data-tab="equipment">设备推荐</a></li>
                        <li><a href="#" class="hover:text-secondary transition-custom tab-link" data-tab="process">工艺优化</a></li>
                        <li><a href="#" class="hover:text-secondary transition-custom tab-link" data-tab="fault">故障诊断</a></li>
                        <li><a href="#" class="hover:text-secondary transition-custom tab-link" data-tab="formula">配方推荐</a></li>
                        <li><a href="#" class="hover:text-secondary transition-custom tab-link" data-tab="market">市场分析</a></li>
                    </ul>
                </div>
                
                <div>
                    <h4 class="font-semibold mb-4">联系我们</h4>
                    <ul class="space-y-2 text-gray-400 text-sm">
                        <li><i class="fa fa-map-marker w-5 text-secondary"></i> 江苏省</li>
                        <li><i class="fa fa-phone w-5 text-secondary"></i> 400-123-4567</li>
                        <li><i class="fa fa-envelope w-5 text-secondary"></i> contact@forxee.com</li>
                    </ul>
                </div>
                
                <div>
                    <h4 class="font-semibold mb-4">关注我们</h4>
                    <div class="flex space-x-4 mb-4">
                        <a href="#" class="w-10 h-10 rounded-full bg-gray-700 flex items-center justify-center hover:bg-secondary transition-custom">
                            <i class="fa fa-weixin"></i>
                        </a>
                        <a href="#" class="w-10 h-10 rounded-full bg-gray-700 flex items-center justify-center hover:bg-secondary transition-custom">
                            <i class="fa fa-weibo"></i>
                        </a>
                        <a href="#" class="w-10 h-10 rounded-full bg-gray-700 flex items-center justify-center hover:bg-secondary transition-custom">
                            <i class="fa fa-youtube-play"></i>
                        </a>
                    </div>
                    <p class="text-gray-400 text-sm">
                        扫描二维码，关注微信公众号获取更多行业资讯
                    </p>
                </div>
            </div>
            
            <div class="border-t border-gray-700 mt-8 pt-6 text-center text-gray-500 text-sm">
                <p>© 2023 果蔬汁机械有限公司 版权所有</p>
            </div>
        </div>
    </footer>

    <!-- JavaScript -->
    <script>
        // 标签页切换功能
        document.addEventListener('DOMContentLoaded', function() {
            const tabBtns = document.querySelectorAll('.tab-btn');
            const tabContents = document.querySelectorAll('.tab-content');
            const tabLinks = document.querySelectorAll('.tab-link');
            
            // 标签按钮点击事件
            tabBtns.forEach(btn => {
                btn.addEventListener('click', () => {
                    const tabId = btn.getAttribute('data-tab');
                    
                    // 更新按钮状态
                    tabBtns.forEach(b => b.classList.remove('tab-active'));
                    btn.classList.add('tab-active');
                    
                    // 更新内容区域
                    tabContents.forEach(content => {
                        content.classList.add('hidden');
                        content.classList.remove('active');
                    });
                    
                    const activeContent = document.getElementById(`${tabId}-content`);
                    activeContent.classList.remove('hidden');
                    activeContent.classList.add('active');
                    
                    // 显示对应的结果区域（如果存在）
                    const resultArea = document.getElementById(`${tabId}Result`);
                    if (resultArea) {
                        resultArea.classList.remove('hidden');
                    }
                });
            });
            
            // 页脚标签链接点击事件
            tabLinks.forEach(link => {
                link.addEventListener('click', (e) => {
                    e.preventDefault();
                    const tabId = link.getAttribute('data-tab');
                    const targetBtn = document.querySelector(`.tab-btn[data-tab="${tabId}"]`);
                    if (targetBtn) {
                        targetBtn.click();
                        // 滚动到标签页区域
                        document.querySelector('.tab-content').scrollIntoView({ behavior: 'smooth' });
                    }
                });
            });
            
            // 图片预览功能
            const rawMaterialImage = document.getElementById('rawMaterialImage');
            const imagePreview = document.getElementById('imagePreview');
            const previewImg = document.getElementById('previewImg');
            
            if (rawMaterialImage && imagePreview && previewImg) {
                rawMaterialImage.addEventListener('change', function(e) {
                    if (e.target.files && e.target.files[0]) {
                        const reader = new FileReader();
                        reader.onload = function(e) {
                            previewImg.src = e.target.result;
                            imagePreview.classList.remove('hidden');
                        }
                        reader.readAsDataURL(e.target.files[0]);
                    }
                });
            }
            
            // 故障图片预览
            const faultImage = document.getElementById('faultImage');
            const faultImagePreview = document.getElementById('faultImagePreview');
            const faultPreviewImg = document.getElementById('faultPreviewImg');
            
            if (faultImage && faultImagePreview && faultPreviewImg) {
                faultImage.addEventListener('change', function(e) {
                    if (e.target.files && e.target.files[0]) {
                        const reader = new FileReader();
                        reader.onload = function(e) {
                            faultPreviewImg.src = e.target.result;
                            faultImagePreview.classList.remove('hidden');
                        }
                        reader.readAsDataURL(e.target.files[0]);
                    }
                });
            }
            
            // 处理原料分析表单提交
            const rawMaterialForm = document.getElementById('rawMaterialForm');
            if (rawMaterialForm) {
                rawMaterialForm.addEventListener('submit', async function(e) {
                    e.preventDefault();
                    
                    const rawMaterialName = document.getElementById('rawMaterialName').value;
                    const rawMaterialImage = document.getElementById('rawMaterialImage').files[0];
                    
                    // 显示结果区域和加载指示器
                    const resultArea = document.getElementById('rawMaterialResult');
                    const resultContent = document.getElementById('rawMaterialResultContent');
                    const loadingIndicator = resultArea.querySelector('.loading-indicator');
                    
                    resultArea.classList.remove('hidden');
                    resultContent.innerHTML = '';
                    loadingIndicator.classList.remove('hidden');
                    
                    try {
                        let imageData = null;
                        // 如果有图片，先上传获取base64编码
                        if (rawMaterialImage) {
                            const formData = new FormData();
                            formData.append('file', rawMaterialImage);
                            
                            const uploadResponse = await fetch('/api/upload-image', {
                                method: 'POST',
                                body: formData
                            });
                            
                            if (!uploadResponse.ok) {
                                throw new Error('图片上传失败');
                            }
                            
                            const uploadResult = await uploadResponse.json();
                            imageData = uploadResult.image_data;
                        }
                        
                        // 调用API进行原料分析
                        const response = await fetch('/api/analyze-raw-material', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json'
                            },
                            body: JSON.stringify({
                                raw_material: rawMaterialName,
                                image_data: imageData
                            })
                        });
                        
                        if (!response.ok) {
                            throw new Error(`API请求失败: ${response.status}`);
                        }
                        
                        const result = await response.json();
                        
                        if (result.success) {
                            // 转换Markdown为HTML显示
                            resultContent.innerHTML = marked.parse(result.result);
                        } else {
                            resultContent.innerHTML = `<div class="text-red-600">错误: ${result.error}</div>`;
                        }
                    } catch (error) {
                        console.error('处理失败:', error);
                        resultContent.innerHTML = `<div class="text-red-600">处理失败: ${error.message}</div>`;
                    } finally {
                        loadingIndicator.classList.add('hidden');
                    }
                });
            }
            
            // 处理设备推荐表单提交
            const equipmentForm = document.getElementById('equipmentForm');
            if (equipmentForm) {
                equipmentForm.addEventListener('submit', async function(e) {
                    e.preventDefault();
                    
                    const capacity = parseFloat(document.getElementById('capacity').value);
                    const productType = document.getElementById('productType').value;
                    const productionScale = document.getElementById('productionScale').value;
                    const rawMaterials = document.getElementById('rawMaterials').value.split(',').map(mat => mat.trim());
                    
                    // 显示结果区域和加载指示器
                    const resultArea = document.getElementById('equipmentResult');
                    const resultContent = document.getElementById('equipmentResultContent');
                    const loadingIndicator = resultArea.querySelector('.loading-indicator');
                    
                    resultArea.classList.remove('hidden');
                    resultContent.innerHTML = '';
                    loadingIndicator.classList.remove('hidden');
                    
                    try {
                        // 调用API进行设备推荐
                        const response = await fetch('/api/recommend-equipment', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json'
                            },
                            body: JSON.stringify({
                                capacity: capacity,
                                raw_materials: rawMaterials,
                                product_type: productType,
                                production_scale: productionScale
                            })
                        });
                        
                        if (!response.ok) {
                            throw new Error(`API请求失败: ${response.status}`);
                        }
                        
                        const result = await response.json();
                        
                        if (result.success) {
                            // 转换Markdown为HTML显示
                            resultContent.innerHTML = marked.parse(result.result);
                        } else {
                            resultContent.innerHTML = `<div class="text-red-600">错误: ${result.error}</div>`;
                        }
                    } catch (error) {
                        console.error('处理失败:', error);
                        resultContent.innerHTML = `<div class="text-red-600">处理失败: ${error.message}</div>`;
                    } finally {
                        loadingIndicator.classList.add('hidden');
                    }
                });
            }
            
            // 处理工艺优化表单提交
            const processForm = document.getElementById('processForm');
            if (processForm) {
                processForm.addEventListener('submit', async function(e) {
                    e.preventDefault();
                    
                    const processRawMaterials = document.getElementById('processRawMaterials').value.split(',').map(mat => mat.trim());
                    const processProductType = document.getElementById('processProductType').value;
                    const currentIssues = document.getElementById('currentIssues').value;
                    const productionData = document.getElementById('productionData').value;
                    
                    // 显示结果区域和加载指示器
                    const resultArea = document.getElementById('processResult');
                    const resultContent = document.getElementById('processResultContent');
                    const loadingIndicator = resultArea.querySelector('.loading-indicator');
                    
                    resultArea.classList.remove('hidden');
                    resultContent.innerHTML = '';
                    loadingIndicator.classList.remove('hidden');
                    
                    try {
                        // 调用API进行工艺优化
                        const response = await fetch('/api/optimize-process', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json'
                            },
                            body: JSON.stringify({
                                raw_materials: processRawMaterials,
                                product_type: processProductType,
                                current_issues: currentIssues,
                                production_data: productionData
                            })
                        });
                        
                        if (!response.ok) {
                            throw new Error(`API请求失败: ${response.status}`);
                        }
                        
                        const result = await response.json();
                        
                        if (result.success) {
                            // 转换Markdown为HTML显示
                            resultContent.innerHTML = marked.parse(result.result);
                        } else {
                            resultContent.innerHTML = `<div class="text-red-600">错误: ${result.error}</div>`;
                        }
                    } catch (error) {
                        console.error('处理失败:', error);
                        resultContent.innerHTML = `<div class="text-red-600">处理失败: ${error.message}</div>`;
                    } finally {
                        loadingIndicator.classList.add('hidden');
                    }
                });
            }
            
            // 处理故障诊断表单提交
            const faultForm = document.getElementById('faultForm');
            if (faultForm) {
                faultForm.addEventListener('submit', async function(e) {
                    e.preventDefault();
                    
                    const equipmentType = document.getElementById('equipmentType').value;
                    const faultDescription = document.getElementById('faultDescription').value;
                    const faultImage = document.getElementById('faultImage').files[0];
                    
                    // 显示结果区域和加载指示器
                    const resultArea = document.getElementById('faultResult');
                    const resultContent = document.getElementById('faultResultContent');
                    const loadingIndicator = resultArea.querySelector('.loading-indicator');
                    
                    resultArea.classList.remove('hidden');
                    resultContent.innerHTML = '';
                    loadingIndicator.classList.remove('hidden');
                    
                    try {
                        let imageData = null;
                        // 如果有图片，先上传获取base64编码
                        if (faultImage) {
                            const formData = new FormData();
                            formData.append('file', faultImage);
                            
                            const uploadResponse = await fetch('/api/upload-image', {
                                method: 'POST',
                                body: formData
                            });
                            
                            if (!uploadResponse.ok) {
                                throw new Error('图片上传失败');
                            }
                            
                            const uploadResult = await uploadResponse.json();
                            imageData = uploadResult.image_data;
                        }
                        
                        // 调用API进行故障诊断
                        const response = await fetch('/api/diagnose-fault', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json'
                            },
                            body: JSON.stringify({
                                equipment_type: equipmentType,
                                fault_description: faultDescription,
                                image_data: imageData
                            })
                        });
                        
                        if (!response.ok) {
                            throw new Error(`API请求失败: ${response.status}`);
                        }
                        
                        const result = await response.json();
                        
                        if (result.success) {
                            // 转换Markdown为HTML显示
                            resultContent.innerHTML = marked.parse(result.result);
                        } else {
                            resultContent.innerHTML = `<div class="text-red-600">错误: ${result.error}</div>`;
                        }
                    } catch (error) {
                        console.error('处理失败:', error);
                        resultContent.innerHTML = `<div class="text-red-600">处理失败: ${error.message}</div>`;
                    } finally {
                        loadingIndicator.classList.add('hidden');
                    }
                });
            }
            
            // 处理配方推荐表单提交
            const formulaForm = document.getElementById('formulaForm');
            if (formulaForm) {
                formulaForm.addEventListener('submit', async function(e) {
                    e.preventDefault();
                    
                    const formulaRawMaterials = document.getElementById('formulaRawMaterials').value.split(',').map(mat => mat.trim());
                    const targetFlavor = document.getElementById('targetFlavor').value;
                    const nutritionalGoals = document.getElementById('nutritionalGoals').value;
                    const marketPosition = document.getElementById('marketPosition').value;
                    
                    // 显示结果区域和加载指示器
                    const resultArea = document.getElementById('formulaResult');
                    const resultContent = document.getElementById('formulaResultContent');
                    const loadingIndicator = resultArea.querySelector('.loading-indicator');
                    
                    resultArea.classList.remove('hidden');
                    resultContent.innerHTML = '';
                    loadingIndicator.classList.remove('hidden');
                    
                    try {
                        // 调用API进行配方推荐
                        const response = await fetch('/api/recommend-formula', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json'
                            },
                            body: JSON.stringify({
                                raw_materials: formulaRawMaterials,
                                target_flavor: targetFlavor,
                                nutritional_goals: nutritionalGoals,
                                market_position: marketPosition
                            })
                        });
                        
                        if (!response.ok) {
                            throw new Error(`API请求失败: ${response.status}`);
                        }
                        
                        const result = await response.json();
                        
                        if (result.success) {
                            // 转换Markdown为HTML显示
                            resultContent.innerHTML = marked.parse(result.result);
                        } else {
                            resultContent.innerHTML = `<div class="text-red-600">错误: ${result.error}</div>`;
                        }
                    } catch (error) {
                        console.error('处理失败:', error);
                        resultContent.innerHTML = `<div class="text-red-600">处理失败: ${error.message}</div>`;
                    } finally {
                        loadingIndicator.classList.add('hidden');
                    }
                });
            }
            
            // 处理市场分析表单提交
            const marketForm = document.getElementById('marketForm');
            if (marketForm) {
                marketForm.addEventListener('submit', async function(e) {
                    e.preventDefault();
                    
                    const marketProductType = document.getElementById('marketProductType').value;
                    const targetRegion = document.getElementById('targetRegion').value;
                    const marketTrends = document.getElementById('marketTrends').value;
                    
                    // 显示结果区域和加载指示器
                    const resultArea = document.getElementById('marketResult');
                    const resultContent = document.getElementById('marketResultContent');
                    const loadingIndicator = resultArea.querySelector('.loading-indicator');
                    
                    resultArea.classList.remove('hidden');
                    resultContent.innerHTML = '';
                    loadingIndicator.classList.remove('hidden');
                    
                    try {
                        // 调用API进行市场分析
                        const response = await fetch('/api/analyze-market', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json'
                            },
                            body: JSON.stringify({
                                product_type: marketProductType,
                                target_region: targetRegion,
                                market_trends: marketTrends
                            })
                        });
                        
                        if (!response.ok) {
                            throw new Error(`API请求失败: ${response.status}`);
                        }
                        
                        const result = await response.json();
                        
                        if (result.success) {
                            // 转换Markdown为HTML显示
                            resultContent.innerHTML = marked.parse(result.result);
                        } else {
                            resultContent.innerHTML = `<div class="text-red-600">错误: ${result.error}</div>`;
                        }
                    } catch (error) {
                        console.error('处理失败:', error);
                        resultContent.innerHTML = `<div class="text-red-600">处理失败: ${error.message}</div>`;
                    } finally {
                        loadingIndicator.classList.add('hidden');
                    }
                });
            }
            
            // 添加Markdown解析支持
            const markedScript = document.createElement('script');
            markedScript.src = 'https://cdn.jsdelivr.net/npm/marked/marked.min.js';
            document.head.appendChild(markedScript);
            
            // 滚动时导航栏样式变化
            window.addEventListener('scroll', function() {
                const header = document.querySelector('header');
                if (window.scrollY > 10) {
                    header.classList.add('py-2');
                    header.classList.remove('py-3');
                } else {
                    header.classList.add('py-3');
                    header.classList.remove('py-2');
                }
            });
        });
    </script>
</body>
</html>
